<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QX11EmbedWidget Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QX11EmbedWidget Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QX11EmbedWidget class provides an XEmbed client widget.
<a href="#details">More...</a></p>

<p>Inherits <a href="qwidget.html">QWidget</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qx11embedwidget.html#Error-enum">Error</a></b> { Unknown, Internal, InvalidWindowID }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qx11embedwidget.html#QX11EmbedWidget">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />int <b><a href="qx11embedwidget.html#containerWinId">containerWinId</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qx11embedwidget.html#embedInto">embedInto</a></b> (<i>self</i>, int&#160;<i>id</i>)</li><li><div class="fn" />Error <b><a href="qx11embedwidget.html#error">error</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qx11embedwidget.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />bool <b><a href="qx11embedwidget.html#eventFilter">eventFilter</a></b> (<i>self</i>, QObject, QEvent)</li><li><div class="fn" /><b><a href="qx11embedwidget.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qx11embedwidget.html#containerClosed">containerClosed</a></b> ()</li><li><div class="fn" />void <b><a href="qx11embedwidget.html#embedded">embedded</a></b> ()</li><li><div class="fn" />void <b><a href="qx11embedwidget.html#error-2">error</a></b> (QX11EmbedWidget::Error)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QX11EmbedWidget class provides an XEmbed client widget.</p>
<p>XEmbed is an X11 protocol that supports the embedding of a
widget from one application into another application.</p>
<p>An XEmbed <i>client widget</i> is a window that is embedded into
a <i>container</i>. A container is the graphical location that
embeds (or <i>swallows</i>) an external application.</p>
<p>QX11EmbedWidget is a widget used for writing XEmbed applets or
plugins. When it has been embedded and the container receives tab
focus, focus is passed on to the widget. When the widget reaches
the end of its focus chain, focus is passed back to the container.
Window activation, accelerator support, modality and drag and drop
(XDND) are also handled.</p>
<p>The widget and container can both initiate the embedding. If the
widget is the initiator, the X11 window ID of the container that it
wants to embed itself into must be passed to <a href="qx11embedwidget.html#embedInto">embedInto</a>().</p>
<p>If the container initiates the embedding, the window ID of the
embedded widget must be known. The container calls embed(), passing
the window ID.</p>
<p>This example shows an application that embeds a QX11EmbedWidget
subclass into the window whose ID is passed as a command-line
argument:</p>
<pre class="cpp">
 <span class="type">int</span> main(<span class="type">int</span> argc<span class="operator">,</span> <span class="type">char</span> <span class="operator">*</span>argv<span class="operator">[</span><span class="operator">]</span>)
 {
     <span class="type"><a href="qapplication.html">QApplication</a></span> app(argc<span class="operator">,</span> argv);

     <span class="keyword">if</span> (app<span class="operator">.</span>arguments()<span class="operator">.</span>count() <span class="operator">!</span><span class="operator">=</span> <span class="number">2</span>) {
         <a href="qtcore.html#qFatal">qFatal</a>(<span class="string">"Error - expected window id as argument"</span>);
         <span class="keyword">return</span> <span class="number">1</span>;
     }

     <span class="type"><a href="qstring.html">QString</a></span> windowId(app<span class="operator">.</span>arguments()<span class="operator">[</span><span class="number">1</span><span class="operator">]</span>);
     EmbedWidget window;
     window<span class="operator">.</span>embedInto(windowId<span class="operator">.</span>toULong());
     window<span class="operator">.</span>show();

     <span class="keyword">return</span> app<span class="operator">.</span>exec();
 }
</pre>
<p>The problem of obtaining the window IDs is often solved by the
container invoking the application that provides the widget as a
separate process (as a panel invokes a docked applet), passing its
window ID to the new process as a command-line argument. The new
process can then call <a href="qx11embedwidget.html#embedInto">embedInto</a>() with the
container's window ID, as shown in the example code above.
Similarly, the new process can report its window ID to the
container through IPC, in which case the container can embed the
widget.</p>
<p>When the widget has been embedded, it emits the signal <a href="qx11embedwidget.html#embedded">embedded</a>(). If it is closed by
the container, the widget emits <a href="qx11embedwidget.html#containerClosed">containerClosed</a>(). If an
error occurs when embedding, <a href="qx11embedwidget.html#error">error</a>() is emitted.</p>
<p>There are XEmbed widgets available for KDE and GTK+. The GTK+
equivalent of QX11EmbedWidget is GtkPlug. The corresponding KDE 3
widget is called QXEmbed.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Error-enum" />QX11EmbedWidget.Error</h3><table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QX11EmbedWidget.Unknown</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">An unrecognized error occurred.</td>
</tr>
<tr>
<td class="topAlign"><tt>QX11EmbedWidget.InvalidWindowID</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">The X11 window ID of the container was
invalid. This error is usually triggered by passing an invalid
window ID to <a href="qx11embedwidget.html#embedInto">embedInto</a>().</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QX11EmbedWidget" />QX11EmbedWidget.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qx11embedwidget.html">QX11EmbedWidget</a>
object with the given <i>parent</i>.</p>


<h3 class="fn"><a name="containerWinId" />int QX11EmbedWidget.containerWinId (<i>self</i>)</h3><p>If the widget is embedded, returns the window ID of the
container; otherwize returns 0.</p>


<h3 class="fn"><a name="embedInto" />QX11EmbedWidget.embedInto (<i>self</i>, int&#160;<i>id</i>)</h3><p>When this function is called, the widget embeds itself into the
container whose window ID is <i>id</i>.</p>
<p>If <i>id</i> is <i>not</i> the window ID of a container this
function will behave unpredictably.</p>


<h3 class="fn"><a name="error" /><a href="qx11embedwidget.html#Error-enum">Error</a> QX11EmbedWidget.error (<i>self</i>)</h3><p>Returns the type of error that occurred last. This is the same
error code that is emitted by the error() signal.</p>
<p><b>See also</b> <a href="qx11embedwidget.html#Error-enum">Error</a>.</p>


<h3 class="fn"><a name="event" />bool QX11EmbedWidget.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>


<h3 class="fn"><a name="eventFilter" />bool QX11EmbedWidget.eventFilter (<i>self</i>, <a href="qobject.html">QObject</a>, <a href="qevent.html">QEvent</a>)</h3><h3 class="fn"><a name="resizeEvent" />QX11EmbedWidget.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget.resizeEvent</a>().</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="containerClosed" />void containerClosed ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted by the client widget when the container
closes the widget. This can happen if the container itself closes,
or if the widget is rejected.</p>
<p>The container can reject a widget for any reason, but the most
common cause of a rejection is when an attempt is made to embed a
widget into a container that already has an embedded widget.</p>


<h3 class="fn"><a name="embedded" />void embedded ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted by the widget that has been embedded by
an XEmbed container.</p>


<h3 class="fn"><a name="error-2" />void error (QX11EmbedWidget::Error)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted if an error occurred as a result of
embedding into or communicating with a container. The specified
<i>error</i> describes the problem that occurred.</p>
<p><b>See also</b> <a href="qx11embedwidget.html#Error-enum">QX11EmbedWidget.Error</a>.</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>